import { IPSSysMsgTempl } from '../msg/ipssys-msg-templ';
import { IPSWFProcessRole } from './ipswfprocess-role';
import { IPSWFRole } from './ipswfrole';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSWFProcessRoleImpl extends PSModelObjectImpl implements IPSWFProcessRole {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssysmsgtempl: IPSSysMsgTempl | null = null;

  getPSSysMsgTempl(): IPSSysMsgTempl | null {
    if (this.pssysmsgtempl != null) return this.pssysmsgtempl;
    const value = this.M.getPSSysMsgTempl;
    if (value == null) {
      return null;
    }
    this.pssysmsgtempl = this.getPSModel4('msg.IPSSysMsgTempl', value, 'getPSSysMsgTempl') as IPSSysMsgTempl;
    return this.pssysmsgtempl;
  }

  get psSysMsgTempl(): IPSSysMsgTempl | null {
    return this.getPSSysMsgTempl();
  }

  getPSSysMsgTemplMust(): IPSSysMsgTempl {
    const value = this.getPSSysMsgTempl();
    if (value == null) {
      throw new Error('未指定通知消息模板');
    }
    return value;
  }

  protected pswfrole: IPSWFRole | null = null;

  getPSWFRole(): IPSWFRole | null {
    if (this.pswfrole != null) return this.pswfrole;
    const value = this.M.getPSWFRole;
    if (value == null) {
      return null;
    }
    this.pswfrole = this.getPSModel4('wf.IPSWFRole', value, 'getPSWFRole') as IPSWFRole;
    return this.pswfrole;
  }

  get psWFRole(): IPSWFRole | null {
    return this.getPSWFRole();
  }

  getPSWFRoleMust(): IPSWFRole {
    const value = this.getPSWFRole();
    if (value == null) {
      throw new Error('未指定流程角色对象');
    }
    return value;
  }

  get uDField(): string {
    return this.M.uDField;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userData(): string {
    return this.M.userData;
  }

  get userData2(): string {
    return this.M.userData2;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get wFProcessRoleType(): 'WFROLE' | 'LASTTWOSTEPACTOR' | 'LASTTHREESTEPACTOR' | 'LASTSTEPACTOR' | 'UDACTOR' | 'CURACTOR' {
    return this.M.wFProcessRoleType;
  }

  get cCMode(): boolean {
    return this.M.cCMode != null ? this.M.cCMode : false;
  }

  get cls(): string {
    return 'PSWFProcessRoleImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'wf.IPSWFProcessRole') return true;
    return super.instanceof(cls);
  }
}
